package com.mdd.admin.controller.goods;

import com.mdd.admin.config.aop.Log;
import com.mdd.admin.service.comment.IGoodsCommentService;
import com.mdd.admin.validate.comment.GoodsCommentPageParam;
import com.mdd.admin.validate.comment.GoodsCommentReplyParam;
import com.mdd.admin.vo.comment.GoodsCommentListVo;
import com.mdd.common.core.PageResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 服务评价管理
 */
@Api(tags = "服务评价管理")
@RestController
@RequestMapping("api/comment")
public class GoodsCommentController {

    @Resource
    IGoodsCommentService iGoodsCommentService;

    /**
     * 服务评价列表
     *
     * @param params 搜索参数
     * @return Object
     */
    @ApiOperation(value = "服务评价管理 - 分页列表")
    @PostMapping("/list")
    public PageResult<GoodsCommentListVo> list(@RequestBody GoodsCommentPageParam params) {
        PageResult<GoodsCommentListVo> list = iGoodsCommentService.list(params);
        return list;
    }

    /**
     * 服务评价列表
     *
     * @param params 搜索参数
     * @return Object
     */
    @ApiOperation(value = "服务评价管理 - 回复")
    @PostMapping("/reply")
    public void reply(@RequestBody GoodsCommentReplyParam params) {
        iGoodsCommentService.replyComment(params);
    }

    /**
     * 服务评价删除
     *
     * @return Object
     */
    @ApiOperation(value = "服务评价删除")
    @Log(title = "服务评价删除")
    @GetMapping("/del")
    public void del(@RequestParam("id") Long id) {
        iGoodsCommentService.del(id);
    }

}
